<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\BuyLog
 *
 * @property int $id
 * @property int $uid
 * @property string|null $buyable_type
 * @property int $buyable_id
 * @property int $pay_state
 * @property int $transaction_id
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property-read \App\Models\Transaction|null $transaction
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BuyLog newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BuyLog newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BuyLog query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BuyLog whereBuyableId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BuyLog whereBuyableType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BuyLog whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BuyLog whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BuyLog wherePayState($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BuyLog whereTransactionId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BuyLog whereUid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BuyLog whereUpdatedAt($value)
 * @mixin \Eloquent
 */
class BuyLog extends Model
{
    protected $table = 'buy_log';
    protected $primaryKey = 'id';
    protected $fillable = ['uid', 'buyable_type', 'buyable_id', 'pay_state', 'transaction_id'];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function transaction()
    {
        return $this->hasOne(Transaction::class, 'transaction_id', 'transaction_id');
    }
}
